<?php require_once("../../../includes_view/configuracao.php"); ?>
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<title>BVX</title>
<link rel="icon" type="image/ico" href="<?php echo $url; ?>/assets/img/ico/iconeAgence.ico" />
<link href="<?php echo $url; ?>/assets/css/style.css" rel="stylesheet">
<script type="text/javascript" src="<?php echo $url; ?>/assets/js/jquery-1.6.js"></script>
<script type="text/javascript" src="<?php echo $url; ?>/assets/js/jquery-ui-1.8.12.custom.min.js"></script> 
<script type="text/javascript">
	$(document).ready(function(){
        $("tr:nth-child(even)").addClass("even");
    });
</script> 
</head>
<body>
<div id="conteiner corpo sistema grid"> 
<?php
	
	require_once("../../../util/util.php");
	require_once("../regras/negocio/relatorioNegocio.php");
	
	$objNegocio = new RelatorioNegocio();
	
	$veiculos      = array();
	$totalVeiculos = $objNegocio->totalCarrosEstoque();
	$veiculos      = $objNegocio->retornarVeiculosEstoque();
	
?>
<h2>Total de veículos cadastrados: <?=$totalVeiculos?></h2>
<table class='flexgrid' width="100%">
<thead>
    <tr style="background:#EAEAEA; height:30px">
        <td>Placa</td>
        <td>Marca</td>
        <td>Chassi</td>
        <td>Cor</td>
        <td>Ano de Fabricação</td>
        <td>Ano Modelo</td>
        <td>Data Compra</td>
        <td>Valor da Compra</td>
    </tr>
</thead>
<tbody>
<?php 
	$soma = 0;
	foreach($veiculos as $veiculo){  
?>
    <tr>
        <td><?=$veiculo["placa"]?></td>
        <td><?=utf8_encode($veiculo["marca"])?></td>
        <td><?=$veiculo["chassi"]?></td>
        <td><?=utf8_encode($veiculo["cor"])?></td>
        <td><?=$veiculo["anoFabricacao"]?></td>
        <td><?=$veiculo["anoModelo"]?></td>
        <td><?=$veiculo["data"]?></td>   
        <td><?=Util::dbMoeda($veiculo["valorCompra"])?></td>                      
    </tr>
<?php 
	$soma+=$veiculo["valorCompra"];
	} 
?>	       
</tbody>
<tfoot>
    <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td><strong><?=Util::dbMoeda($soma)?></strong></td>
    </tr>
    <tr style="background:#EAEAEA; height:30px">
        <td>Placa</td>
        <td>Marca</td>
        <td>Chassi</td>
        <td>Cor</td>
        <td>Ano de Fabricação</td>
        <td>Ano Modelo</td>
        <td>Data Compra</td>
        <td>Valor da Compra</td>
    </tr>
</tfoot>
</table>
</div>
<br>
</body>
</html>